<?php

declare (strict_types=1);
namespace App\Server\Cache;
use Hyperf\Cache\Cache as hCache;

class Cache
{
    protected $container;
    protected $cache;

    public function __construct()
    {
        $this->container = \Hyperf\Utils\ApplicationContext::getContainer();
        $this->cache     = $this->container->get(hCache::class);
    }

    public function set($key, $value, $ttl = null){
        return $this->cache->set($key, $value, $ttl);
    }

    public function get($key){
        return $this->cache->get($key);
    }

    public function has($key){
        return $this->cache->has($key);
    }

    public function clear(){
        return $this->cache->clear();
    }

    public function delete($key){
        return $this->cache->delete($key);
    }

    public function getMultiple($keys, $default = null){
        return $this->cache->getMultiple($keys, $default);
    }

    public function setMultiple($values, $ttl = null){
        return $this->cache->setMultiple($values, $ttl);
    }

    public function deleteMultiple($keys){
        return $this->cache->deleteMultiple($keys);
    }
}